(use-package shell
  :bind
  ("C-c t s" . shell)
  (:map shell-mode-map
	("C-d" . qrthi/quit-or-delete-char))

  :init
  (defun qrthi/quit-or-delete-char (arg)
    (interactive "p")
    (let ((proc (get-buffer-process (current-buffer))))
      (if (and (eobp) proc (= (point) (marker-position (process-mark proc))))
	  (quit-window)
	(delete-char arg)))))
